{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Section2.ipynb",
      "provenance": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/Tanu-N-Prabhu/Python/blob/master/Src/Section2.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-LXPbirj6_zH",
        "colab_type": "text"
      },
      "source": [
        "# Section 2: Python Basics"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "AkkJ7uwG7klL",
        "colab_type": "text"
      },
      "source": [
        "![alt text](https://i.ytimg.com/vi/gmiB4xQ-BKw/maxresdefault.jpg)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "S7SFMRLM7AbN",
        "colab_type": "text"
      },
      "source": [
        "## 1. Variables and data types\n",
        "\n",
        "A variable is a name of the memory location where we store the data. For example think of box where you store all you belongings inside that box. \n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cUWE7e3u7Dqu",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Creating a bunch of variables with mixture of datatypes like int, float, boolean.\n",
        "var = 20           # Integer data\n",
        "var1 = 20.0        # Float data\n",
        "var2 = False       # Boolean data\n",
        "var3 = -20         # Integer data"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "QpgAsB0Q7FWM",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 139
        },
        "outputId": "1de99ff2-8473-48d7-a5df-6e4877f460a8"
      },
      "source": [
        "# Printing the variables \n",
        "\n",
        "print(var)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(var1)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(var2)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(var3)"
      ],
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "20\n",
            "-------------------------------------------------------------\n",
            "20.0\n",
            "-------------------------------------------------------------\n",
            "False\n",
            "-------------------------------------------------------------\n",
            "-20\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "5iqRB58Y7H5I",
        "colab_type": "text"
      },
      "source": [
        "A datatype refers to the type of data that we store inside a variable. For example we store integer datatype, float datatype and booleab datatype. \n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "L8mXWd-k7JKH",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 139
        },
        "outputId": "82cd4b34-91a0-4a40-bdad-f9f1bdeb3713"
      },
      "source": [
        "# The type of the data can be determined by using type() method.\n",
        "\n",
        "print(type(var))\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(type(var1))\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(type(var2))\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(type(var3))"
      ],
      "execution_count": 9,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "<class 'int'>\n",
            "-------------------------------------------------------------\n",
            "<class 'float'>\n",
            "-------------------------------------------------------------\n",
            "<class 'bool'>\n",
            "-------------------------------------------------------------\n",
            "<class 'int'>\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ebMioqef7Vux",
        "colab_type": "text"
      },
      "source": [
        "\n",
        "\n",
        "---\n",
        "\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-reTM9zI7Lst",
        "colab_type": "text"
      },
      "source": [
        "## 2. Comments and Mathematical operators\n",
        "\n",
        "Comments are very useful especially when you are stuck in understanding the code with the help of comments ypu can understand the code.Single line comments can be written by using \"#\" . It's a good practice to comment your code."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "cLmQahXA7Nib",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# This is a single line comment"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Mo3Xzi__7PZ2",
        "colab_type": "text"
      },
      "source": [
        "Mathematical operators include additon, subtraction, multiplication, division etc. It is very easy to perform mathematical operations in python."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "9BuhtN0X7Qer",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "add = 10 + 5       # Addition\n",
        "sub = 10 - 5       # Subtraction\n",
        "mul = 10 * 5       # Multiplication\n",
        "div = 10 / 5       # Division\n",
        "exp = 10 ** 5      # Exponent\n",
        "floor = 13 // 5    # Floor division\n",
        "mod = 13 % 5       # Modulus operator"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "FcFF5tuf7R37",
        "colab_type": "code",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 243
        },
        "outputId": "5430dd3c-3bd0-4989-c333-a29ac4136568"
      },
      "source": [
        "print(add)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(sub)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(mul)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(div)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(exp)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(floor)\n",
        "print(\"-------------------------------------------------------------\")\n",
        "print(mod)"
      ],
      "execution_count": 12,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "15\n",
            "-------------------------------------------------------------\n",
            "5\n",
            "-------------------------------------------------------------\n",
            "50\n",
            "-------------------------------------------------------------\n",
            "2.0\n",
            "-------------------------------------------------------------\n",
            "100000\n",
            "-------------------------------------------------------------\n",
            "2\n",
            "-------------------------------------------------------------\n",
            "3\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "UuBRpiFt7UKl",
        "colab_type": "text"
      },
      "source": [
        "\n",
        "\n",
        "---\n",
        "\n"
      ]
    }
  ]
}